public class FoxAverageSequence {
	private int[][][][] sequenceCount;

	public int theCount(int[] seq) {
		long[][][] sequenceCount = new long[1][41][2];
		sequenceCount[0][0][0] = 1;
		for (int i = 0; i < seq.length; i++) {
			long[][][] nextSequenceCount = new long[(i + 1) * 40 + 1][41][2];
			for (int j = 0; j <= 40 * i; j++) {
				int max = (i == 0) ? 40 : j / i;
				for (int k = 0; k <= 40; k++) {
					sequenceCount[j][k][0] %= 1000000007;
					sequenceCount[j][k][1] %= 1000000007;
					if (seq[i] != -1) {
						if (seq[i] <= max) {
							if (seq[i] >= k)
								nextSequenceCount[j + seq[i]][seq[i]][0] += sequenceCount[j][k][0] + sequenceCount[j][k][1];
							else
								nextSequenceCount[j + seq[i]][seq[i]][1] += sequenceCount[j][k][0];
						}
					} else {
						for (int l = 0; l <= max; l++) {
							if (l >= k)
								nextSequenceCount[j + l][l][0] += sequenceCount[j][k][0] + sequenceCount[j][k][1];
							else
								nextSequenceCount[j + l][l][1] += sequenceCount[j][k][0];
						}
					}
				}
			}
			sequenceCount = nextSequenceCount;
		}
		long result = 0;
		for (long[][] array0 : sequenceCount) {
			for (long[] array1 : array0) {
				for (long value : array1)
					result += value;
			}
		}
		return (int) (result % 1000000007);
	}

// BEGIN CUT HERE
   public static void main(String[] args) {
		if ( args.length == 0 ) {
			FoxAverageSequenceHarness.run_test(-1);
		} else {
			for ( int i=0; i<args.length; ++i )
				FoxAverageSequenceHarness.run_test(Integer.valueOf(args[i]));
		}
	}
// END CUT HERE
}

// BEGIN CUT HERE
class FoxAverageSequenceHarness {
	public static void run_test( int casenum ) {
		if ( casenum != -1 ) {
			if ( runTestCase( casenum ) == -1 )
				System.err.println("Illegal input! Test case " + casenum + " does not exist.");
			return;
		}
		
		int correct = 0, total = 0;
		for ( int i=0;; ++i ) {
			int x = runTestCase(i);
			if ( x == -1 ) {
				if ( i >= 100 ) break;
				continue;
			}
			correct += x;
			++total;
		}
		
		if ( total == 0 ) {
			System.err.println("No test cases run.");
		} else if ( correct < total ) {
			System.err.println("Some cases FAILED (passed " + correct + " of " + total + ").");
		} else {
			System.err.println("All " + total + " tests passed!");
		}
	}
	
	static boolean compareOutput(int expected, int result) { return expected == result; }
	static String formatResult(int res) {
		return String.format("%d", res);
	}
	
	static int verifyCase( int casenum, int expected, int received ) { 
		System.err.print("Example " + casenum + "... ");
		if ( compareOutput( expected, received ) ) {
			System.err.println("PASSED");
			return 1;
		} else {
			System.err.println("FAILED");
			System.err.println("    Expected: " + formatResult(expected)); 
			System.err.println("    Received: " + formatResult(received)); 
			return 0;
		}
	}

	static int runTestCase( int casenum ) {
		switch( casenum ) {
		case 0: {
			int[] seq                 = {3, -1};
			int expected__            = 4;

			return verifyCase( casenum, expected__, new FoxAverageSequence().theCount( seq ) );
		}
		case 1: {
			int[] seq                 = {5, 3, -1};
			int expected__            = 2;

			return verifyCase( casenum, expected__, new FoxAverageSequence().theCount( seq ) );
		}
		case 2: {
			int[] seq                 = {-1, 0, 40};
			int expected__            = 0;

			return verifyCase( casenum, expected__, new FoxAverageSequence().theCount( seq ) );
		}
		case 3: {
			int[] seq                 = {-1, 40, -1, -1, -1, 10, -1, -1, -1, 21, -1};
			int expected__            = 579347890;

			return verifyCase( casenum, expected__, new FoxAverageSequence().theCount( seq ) );
		}
		case 4: {
			int[] seq                 = {-1, 12, 25, 0, 18, -1};
			int expected__            = 58;

			return verifyCase( casenum, expected__, new FoxAverageSequence().theCount( seq ) );
		}

		// custom cases

/*      case 5: {
			int[] seq                 = ;
			int expected__            = ;

			return verifyCase( casenum, expected__, new FoxAverageSequence().theCount( seq ) );
		}*/
/*      case 6: {
			int[] seq                 = ;
			int expected__            = ;

			return verifyCase( casenum, expected__, new FoxAverageSequence().theCount( seq ) );
		}*/
/*      case 7: {
			int[] seq                 = ;
			int expected__            = ;

			return verifyCase( casenum, expected__, new FoxAverageSequence().theCount( seq ) );
		}*/
		default:
			return -1;
		}
	}
}

// END CUT HERE
